window.onload = function () {
        //对象扩展
        const o1 = {};
        o1.name = 'jack';
        o1['age'] = 18;
        let v = 'value';
        o1[v] = '100';

        const o2 = {
          [v]:'abc',
          [`my${v}`]:'xyz'
        };
        console.log(o2);

        var str = "id" ||"name"
        const o5 = {
           [str]:1
        };

        //运算符 ?.  链判断运算符
        const o3 = {
                id:1,
                name:'any',
                getName:function(){
                        return this.name
                }
        };
        o3?.id //=>o3 && o3.id
        o3?.name
        o3?.getName?.() || 1

        if(o3?.getName?.()=='abc'){}

        //?? 空值合并操作符
        let x = 10 ?? 1;
        console.log(x); //10

        let x1 = null ?? 1;
        console.log(x1); //1

        let x2 = undefined ?? 1;
        console.log(x2); //1



        





}



